package clientDemo.demo;

import clientDemo.entity.MissionWork;
import clientDemo.entity.MissionWorkAction;
import clientDemo.service.MissionWorkService;
import clientDemo.service.impl.MissionWorkServiceImpl;

import java.util.List;

public class MissionWorkDemo {
    public static void main(String[] args) {
    	
    	/*
    	 * @describe 创建工作通过任务ID
    	 * @method   post请求
    	 * @url      http://ip:port/api/v2/missionWorks/{missionId}
    	 */
    	
    	//在机器人执行工作之前，需要在YOUIFleet中先创建好任务。我们需要先获取到任务的ID，才能创建调度工作。
        String missionId="2035ee2f-c965-11e9-b01f-b0416f03e8c3";
        MissionWorkService missionWorkService=new MissionWorkServiceImpl();
        MissionWork missionWork= missionWorkService.create(missionId);
        
        /*
    	 * @describe 暂停工作
    	 * @method   post请求
    	 * @url      http://ip:port/api/v2/missionWorks/{id}/controls/pause
    	 */
        String missionWorkId=missionWork.getId();
        missionWorkService.pause(missionWorkId);

        
        /*
    	 * @describe 恢复工作
    	 * @method   post请求
    	 * @url      http://ip:port/api/v2/missionWorks/{id}/controls/resume
    	 */
        missionWorkService.resume(missionWorkId);

       
        /*
    	 * @describe 停止工作
    	 * @method   post请求
    	 * @url      http://ip:port/api/v2/missionWorks/{id}/controls/stop
    	 */
        missionWorkService.stop(missionWorkId);


        /*
    	 * @describe 查询工作动作列表
    	 * @method   get请求
    	 * @url      http://ip:port/api/v2/missionWorks/{id}/missionWorkActions
    	 */
        List<MissionWorkAction> missionWorkActionList=missionWorkService.getMissionWorkActions(missionWorkId);
        missionWorkActionList.get(0);
    }
}
